package com.example.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserDao userDao;

    @RequestMapping("/getByEmail")
    @ResponseBody
    public User getByEmail(String email) {
        String userId;
        User user = userDao.findByEmail(email);
        //System.out.print(user.toString());
        if (user != null) {
            userId = String.valueOf(user.getUserName());
            return user;
        }
        return null;
    }
}